Socket
Socket
Sign inDemoInstall

get-urls

Package Overview
Dependencies
4
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    get-urls

Get all URLs in a string


Version published
Weekly downloads
27K
decreased by-6.05%
Maintainers
1
Install size
80.1 kB
Created
Weekly downloads
 

Readme

Source

get-urls Build Status

Get all URLs in a string

The URLs will be normalized.

Don't use this for any kind of security-related validation.

Install

$ npm install get-urls

Usage

const getUrls = require('get-urls');

const text = 'Lorem ipsum dolor sit amet, //sindresorhus.com consectetuer adipiscing http://yeoman.io elit.';

getUrls(text);
//=> Set {'http://sindresorhus.com', 'http://yeoman.io'}

API

getUrls(text, options?)

Returns a Set of URLs.

text

Type: string

options

Type: object

All the normalize-url options in addition to:

extractFromQueryString

Type: boolean
Default: false

Extract URLs that appear as query parameters in the found URLs.

exclude

Type: string[]
Default: []

Exclude URLs that match URLs in the given array.

requireSchemeOrWww

Type: boolean
Default: true

Require URLs to have a scheme or leading www. to be considered an URL. When false, matches against a list of valid TLDs, so it will match URLs like unicorn.education.

Does not affect URLs in query parameters if using the extractFromQueryString option.

Keywords

FAQs

Last updated on 28 Jun 2020

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc